#include <vector>
#include "test.hpp"
#include "return_value_behavior.hpp"
#include "behaviors_replayer.hpp"
#include "invocation_matcher.hpp"
#include "argument_matcher.hpp"
#include "exact_argument_matcher.hpp"
#include "expectation_not_meet_exception.hpp"

using std::vector;

namespace vimock {
TEST_CASE(replay_test)
{
	object obj(1);
	object func(2);
	argument_matcher_vector argument_matchers(new vector<argument_matcher>());
	invocation_matcher inv_matcher(new _invocation_matcher(obj, func, argument_matchers));
	object_vector arguments(new vector<object>());
	invocation inv(new _invocation(obj, func, arguments));

	behavior_vector behaviors(new vector<behavior>());
	behavior behavior1(new return_value_behavior(inv_matcher, 1));
	behaviors->push_back(behavior1);
	behavior behavior2(new return_value_behavior(inv_matcher, 2));
	behaviors->push_back(behavior2);
	behaviors_replayer replayer(behaviors);
	assert_are_equal(1, replayer.replay(inv).to<int>());
	assert_are_equal(2, replayer.replay(inv).to<int>());
}
TEST_CASE(verify_should_throw_expectation_not_meet_exception_when_more_behaviors_to_come)
{
	argument_matcher_vector argument_matchers(new vector<argument_matcher>());
	invocation_matcher inv_matcher(new _invocation_matcher(1, 2, argument_matchers));
	behavior_vector behaviors(new vector<behavior>());
	behavior behavior1(new return_value_behavior(inv_matcher, 1));
	behaviors->push_back(behavior1);
	behaviors_replayer replayer(behaviors);
	assert_thrown(expectation_not_meet_exception, replayer.verify());
}
TEST_CASE(verify_should_not_throw_exception_when_all_expectation_meet)
{
	behavior_vector behaviors(new vector<behavior>());
	behaviors_replayer replayer(behaviors);
	replayer.verify();
}
}
